<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="https://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
    <script>
        $(function () {
            $("#first>p").css("color","blue");
            $("#second~p").css("color","red");
            $("#second+p").css("color","pink");
        })
    </script>
</head>
<body>
    <div id="first">
        <p>lvye的子元素</p>
        <p>lvye的子元素</p>
        <div id="second">
            <p>lvye子元素的子元素</p>
            <p>lvye子元素的子元素</p>
        </div>
        <p>lvye的子元素</p>
        <p>lvye的子元素</p>
    </div>
</body>
</html>